<?php
/*REQUIERE $_SESSION['ClienteID'] y $_SESSION['PersonaID'] previamente establecido */
if (isset($_POST['bTblX'])){
	delCreditCard($_POST['iID']);
}

?>


<br />


<style>
.td{
	border-bottom-style:none;
    border-left-style:none;
}
</style>

<script languaje="JavaScript">

function setStyle(style,item) {
item.className = style;
}

function addBoton(bot){
	document.getElementById(bot).className = "bSubmitX";
}
function dropBoton(bot){
	document.getElementById(bot).className = "bSubmitHide";
}

</script>


<br /> 
<table>
<tr align="left">
	<td class="tdCarpeta" style="width:80px">
							<a href="?site=regi_editar&id=<?php echo $_SESSION['PersonaID']; ?>">
                    <img src="../../../images/back.png" title="Regresar" width="60" height="45"/></a>
	</td>
</tr>
<tr>
	<td class="tdCarpeta"> <a href="?site=regi_editar&id=<?php echo $_SESSION['PersonaID']; ?>">Regresar </a>
	</td>
</tr>
</table>

<div class="table" style="margin-left:3px;">
  <div class="tr" style="background-color:#7E97E9;">
    <div class="td" style="width:350px">Tipo</div>
    <div class="td" style="width:150px"> Numero</div>
    <div class="td" style="width:170px">Nombre en tarjeta</div>
    <div class="td" style="width:170px">Expira</div>
    <div class="td" style="width:30px"></div>

  </div>
<?php
			$cards = getCreditCardInfo($_SESSION['ClienteID']); // 0 es retornar todas las tarjetas
		
			$num = count($cards);

			for($i=0;$i < $num;$i++){	
			$card = $cards[$i];
			
						
			print("<div class='tr' onmouseover=\"setStyle('trMouseOver',this);addBoton(".$card->get_ID().");\"onmouseout=\"setStyle('tr',this);dropBoton(".$card->get_ID().");\">");
			
			print("<div class='td' style='width:200px;text-align:justify'>".
			"<a href='index.php?site=card_editar&id=".$card->get_ID()."'>".getMarca($card->get_tipo())."</a></div>");
			print("<div class='td' style='width:150px'>".
			"<a href='index.php?site=card_editar&id=".$card->get_ID()."'>".$card->get_numero()."</a></div>");			
			print("<div class='td' style='width:120px'>".$card->get_titular()."</div>");
			print("<div class='td' style='width:120px'>".$card->get_mesExp().'/'.$card->get_anoExp()."</div>");
			print("<div class='td' style='width:30px'>");
			

			print("
				  		<form action='' method='POST' style='display:hidden'>
						<input id=\"".$card->get_ID()."\" name=\"bTblX\" type=\"submit\" value=\"x\" class=\"bSubmitHide\"/>
						<input name=\"iID\" type=\"hidden\" value=\"".$card->get_ID()."\"/>
						</form>
				  ");
			
			print("</div></div>");
			}	

?>
</div>

<?php include 'card_crear.php'; ?>

